using System.Windows.Browser;
using System.Windows.Controls;
using Lib.Helper;
using MSIACCSL2;
using WcfService1.DTO;

namespace BTB
{
    public partial class Index : Page
    {
        public BTBViewModel ViewModel
        {
            get
            {
                return this.DataContext as BTBViewModel;
            }
        }
        public Index()
        {
            InitializeComponent();
            BTBViewModel.OnSearchCompleted = (x) =>
                                          {
                                              this.DataContext = (BTBViewModel)x;
                                          };
        }

        private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            var btb = (sender as Button).DataContext as BTBDTO;
            //GlobalVar.OkaSocket.SendMessage("BTB|" + btb.NoBtb);
            MyButton button = new MyButton(GlobalVar.ReportUrl + "BTB.aspx?no=" + HttpUtility.UrlEncode(btb.NoBtb));
            button.ClickMe();
        }

        private void btnSend_Click(object sender, System.Windows.RoutedEventArgs e)
        {
        	ViewModel.SendEmail((sender as Button).DataContext);
        }

     

    
    }
}


